package lvtu.opencv.util;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import org.apache.commons.lang.StringUtils;

/**
 * @author waynechen Mar 12, 2012 11:23:14 AM
 */
public class ConfigUtils {
    
    
	private static String tempPath; 
	
	private static String CASCADE_FILE;
	
	private static String LIMIT_NUM;
	
	private static String scale_factor;
	
	
	public static String getLimitNum(){
		return LIMIT_NUM;
	}
	
	public static String getTempPath() {
		// TODO Auto-generated method stub
		return tempPath;
	}
	
	public static String getCascade(){
		return CASCADE_FILE;
	}
	static{
		Properties props = new Properties();
		try {
			//props.load(JdbcUtils.class.getClassLoader().getResourceAsStream("jdbc.properties"));
			//props.load(new FileInputStream(JdbcUtils.class.getClassLoader().getResource("jdbc.properties").getPath()));
			props.load(new FileInputStream("config.properties"));
		} catch (IOException e) {
			e.printStackTrace();
		}

		tempPath = props.getProperty("path");
		CASCADE_FILE = props.getProperty("CASCADE_FILE");
		LIMIT_NUM = props.getProperty("LIMIT_NUM");
		scale_factor = props.getProperty("scale_factor");
		//System.out.println("爬虫启动时间："+hour+":"+min+":"+sec);
	}
	public static Double getScaleFactor() {
		
		
		return StringUtils.isBlank(scale_factor)?1.5:Double.valueOf(scale_factor);
	}

	

}
